package com.test.testCode.test;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.stream.Collectors;

public class HasSame {

    public static void main(String[] args) {
        List<Object> list = new ArrayList<>();
        list.add("语文");
        list.add("数学");
        list.add("语文");
        list.add("历史");
        list.add("化学");

        System.out.println(list.stream().distinct().collect(Collectors.toList()));
        int size = new HashSet<Object>(list).size();
        System.out.println(size);
    }
}
